UART Bandwidth Calculation
Below is an equation for the maximum theoretical UART baud rate for a given message configuration. Although it is possible to calculate the approximate bandwidth required for a given setup, there is no guarantee that the system can support that setup due to internal processing delays. In addition, it is critical to account for command responses in the data stream. Verify the baudrate can support the requested data output rate by streaming data and watching for dropped packets or failed command responses. If there are dropped packets, increase the baud rate, reduce the data rate, or decrease the size or number of packets.
Where:
Sf = size of data field in bytes
fdr = field of data rate in Hz
fmr = maximum date rate in Hz
n = size of UART word = 10 bits
k = size of MIP wrapper = 6 bytes
which becomes:
Example:
For an IMU message format of Accelerometer Vector (14 byte data field) + Internal Timestamp (six byte data field), both at 100 Hz, the theoretical minimum baud rate would be:
In practice, if you set the baud rate to 115200 the packets come through without any packet drops. If you set the baud rate to the next available lower rate of 19200, which is lower than the calculated minimum, you get regular packet drops. The only way to determine a packet drop is by observing a timestamp in sequential packets. The interval should not change from packet to packet. If it does change then packets were dropped.